//
//  ViewController.m
//  Afnetworking_Txt
//
//  Created by  荔明浩 on 2017/11/22.
//  Copyright © 2017年 2pac. All rights reserved.
//

#import "ViewController.h"
#import <AFNetworkReachabilityManager.h>


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self netChange];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



//监听网络变化
- (void)netChange {
    AFNetworkReachabilityManager * manager = [AFNetworkReachabilityManager sharedManager];
    [manager startMonitoring];
    [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        switch (status) {
            case -1:
                NSLog(@"no Unknown");
                break;
                
            case 0:
                NSLog(@"NotReachable  么网络");
                break;
            case 1:
                NSLog(@" 3g 4g");
                break;
            case 2:
                NSLog(@"wifi");
                break;
            default:
                break;
        }
    }];
}

@end
